package com.example.miaosha.validator;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by lerry_li on 2020/10/16
 */

public class ValidationResult {
    //校验结果是否有错
    @Getter
    @Setter
    private boolean hasError=false;

    //存放错误信息的map
    @Getter
    @Setter
    private Map<String,String> errorMsgMap=new HashMap<>();

    //实现通用的通过格式化字符串信息获取错误结果的msg方法
    public String getErrMsg(){
        return StringUtils.join(errorMsgMap.values().toArray(),",");
    }
}
